﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="NewReviewComment.aspx.cs" Inherits="CodeDemon.Views.Review.NewReviewComment" %>

<%
    var reviewer = (from partlist in ViewData.Model.DAO.GetReviewParticipantsByReviewID(ViewData.Model.CurrentReviewID) where partlist.ParticipantIsReviewer == true && partlist.ReviewUserID == ViewData.Model.CurrentReviewUserID select partlist).Count();

 %>


<h3>Add Review Comments</h3>

<form action="/CodeDemon/Review/InsertReviewComment" method="post" id="htmlForm">

<p>
    <textarea name="commentText" rows="10" cols="50"></textarea>
</p>

<%var sevs = from sevlist in ViewData.Model.DAO.Severity select sevlist; %>
<div>
    <label for="severityID">Severity:
    <select name="severityID">
        <%foreach (var sev in sevs ) { %>
            <option value="<%= sev.SeverityID %>"><%= sev.SeverityName %></option>
        
        <%} %>
    
    </select></label>
</div>

<div><label for="priority">Priority: <select name="priority">
    <option value="1">P1 - Lowest</option>
    <option value="2">P2</option>
    <option value="3" selected="selected">P3</option>
    <option value="4">P4</option>
    <option value="5">P5 - Highest</option>
</select></label></div>

<% if(reviewer > 0 ) { %>

<div><label for="change_status">Change Review Status:</label><input id="change_status" name="change_status" value="yes" type="checkbox" /></div>

<div id="status_change_menu" style="display:none;">
     <%

        var sl = from statusList in ViewData.Model.DAO.ReviewStatus where statusList.IsParticipantStatus == true select statusList;
        
         %>
         
         <% foreach (var s in sl) { %>
            <div><label for="newStatusId<%= s.ReviewStatusID %>"><input type="radio" id="newStatusId<%= s.ReviewStatusID %>" name="newStatusId" value="<%= s.ReviewStatusID %>" />Set Status To <%=s.StatusName %></label></div>
         <% } %>
</div>

<% } %>
<!--
<div><label for="bug_create">Create New Defect:<input type="checkbox" id="bug_create" name="bug_create" value="yes" type="checkbox" /></label></div>
<div id="bug_create_menu">
    <div><label for="defect_title">New Defect Title: <input type="text" value="" name="defect_title" id="defect_title" size="50" /></label></div>
</div>
-->
<p>
<input value="Add Comment " name="SubmitNow" id="SubmitNow" type="submit" />
<input value="Cancel" name="Cancel" type="button" class="jqmClose" />
    <input type="hidden" name="ReviewId" id="ReviewId" value="<%= ViewData.Model.CurrentReviewID %>" />
</p>

<div id="results">
    Review Comment Added.  <a href="#" class="jqmClose">Close Window</a>
</div>

<script type="text/javascript">
// prepare the form when the DOM is ready 
$(document).ready(function() { 
    $('#status_change_menu').hide(); 
    $('#bug_create_menu').hide();
    
    $('#change_status').click(function() {
        $('#status_change_menu').toggle('1'); 
    });
    $('#bug_create').click(function() {
        $('#bug_create_menu').toggle('1');
    });
    $('#results').hide();
    // bind form using ajaxForm 
    $('#htmlForm').ajaxForm({ 
        // target identifies the element(s) to update with the server response 
        target: '#results', 
 
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() { 
            $('#results').show('1'); 
            getComments('<%=ViewData.Model.CurrentReviewID %>');
            $('#ex2').jqmHide();
        } 
    }); 
});
</script>

</form>
